﻿using System.Windows;
using System.Windows.Media.Animation;

namespace MvvmFx.Common.Helpers
{
    /// <summary>
    /// Static utility class for Animation helper methods
    /// </summary>
    public static class AnimationHelper
    {
        public static void CreateAnimation(Storyboard storyboard,
                                           DependencyObject target,
                                           string targetProperty,
                                           PointAnimation pointAnim)
        {

            storyboard.Children.Add(pointAnim);

            Storyboard.SetTarget(pointAnim, target);
            Storyboard.SetTargetProperty(pointAnim, new PropertyPath(targetProperty));
        }

        public static void CreateAnimation(Storyboard storyboard,
                                           DependencyObject target,
                                           string targetProperty,
                                           DoubleAnimation doubleAnim)
        {

            storyboard.Children.Add(doubleAnim);

            Storyboard.SetTarget(doubleAnim, target);
            Storyboard.SetTargetProperty(doubleAnim, new PropertyPath(targetProperty));
        }
    }
}